<?php
$contentResult = '<tbody>';
$squareSum = 0;

for ($i = 0; $i <= 100; $i += 2) {
    $sqrt = sqrt($i);
    $squareSum += $sqrt;
    $contentResult .= '<tr><td>' . $i . '</td><td>' . $sqrt .  '</td></tr>';
}

$contentResult .= '</tbody>';

$result = '<table><thead><tr><th>Number</th><th>Square</th></tr></thead>';
$result .= "<tfoot><tr><td>Total:</td><td>$squareSum</td></tr></thead>";
$result .= $contentResult;
$result .= '</table>';

echo $result;
?>